package com.lp;
import java.util.Observable;
import java.util.Observer;


public class MyObServer implements Observer {
	private int index;
	
	public MyObServer() {
	}
	
	public MyObServer(int index) {
		this.index = index;
	}
	public int getIndex() {
		return index;
	}
	public void setIndex(int index) {
		this.index = index;
	}
	
	public void update(Observable o, Object arg) {
		System.out.println("对象发生变化,观察者编号为："+index);
		Person person = (Person) o;
		System.out.println("姓名："+person.getName()+"，性别："+person.getSex()+"，年龄："+person.getAge());
	}
}
